<template>
  <div class="dashboard-editor-container">
    管理端首页
    <!--弹框-->
    <el-dialog :visible.sync="dialog" title="" width="70%" />

    <v-contextmenu ref="contextmenu" auto-placement>
      <v-contextmenu-item @click="number">这是第一个测试</v-contextmenu-item>
    </v-contextmenu>

    <div v-contextmenu:contextmenu @contextmenu.prevent>
      右击这里
    </div>

    <el-input v-model="famount" v-enterNumber placeholder="请输入内容" />

    <input type="button" value="提交" @click="test()">

    <!--<Filtrate />-->

    <!-- 内容部分 -->
    <!--<FilterBar
      top="40"
      :bar-menus="barMenus"
      @showDialog="handleShowDialog"
      @closeDialog="handleCloseDialog"
      @changeTab="handleChangeTab"
      @changeMainItem="handleChangeMainItem"
      @changeSelect="changeData"
    />-->
  </div>
</template>

<script>
import Filtrate from './components/Filtrate/index'
// getUserInfo
import { getUserInfo } from '@/api/login'
// 引入组件
import FilterBar from './components/FilterBar/FilterBar.vue'
// 引入假数据
import barMenus from './data.js'

export default {
  name: 'DashboardAdmin',
  components: {
    FilterBar
  },
  data() {
    return {
      dialog: false,
      famount: '',

      barMenus: barMenus
    }
  },
  methods: {

    handleShowDialog(v) {
      console.log(v)
    },
    handleCloseDialog(v) {
      console.log(v)
    },
    handleChangeTab(v) {
      console.log(v)
    },
    handleChangeMainItem(v) {
      console.log(v)
    },
    changeData(v) {
      console.log(v)
    },

    // ----------------------------------------------------

    number() {
      // this.famount = this.famount.replace(/[^\.\d]/g, '')
      // this.famount = this.famount.replace('.', '')
      // this.$router.replace({ name: 'Nested' })
    },

    async test() {
      const infoData = await this.info()
      const info1Data = await this.info1()
      console.log(infoData, 0)
      console.log(info1Data, 1)
    },

    info() {
      return new Promise((resolve, reject) => {
        getUserInfo().then(response => {
          var data = response.data.data
          console.log('info-0')
          resolve(data)
        })
      })
    },

    info1() {
      return new Promise((resolve, reject) => {
        getUserInfo().then(response => {
          var data = response.data.data
          console.log('info-1')
          resolve(data)
        })
      })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.dashboard-editor-container {
  padding: 32px;

  .chart-wrapper {
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}
</style>
